package com.code.springbootpoi.test;

import java.util.Comparator;

/*
 * @author: liyufei
 * @date: 2018-07-17 15:15
 */
public class MyComparator implements Comparator<Student> {

    @Override
    public int compare(Student s1,Student s2) {
        int num = new Integer(s1.getAge()).compareTo(new Integer(s2.getAge()));
        if (num == 0) {
            return s1.getName().compareTo(s2.getName());
        }
        return new Integer(s1.getAge()).compareTo(new Integer(s2.getAge()));
    }

}
